package com.atguigu.thread;
import com.atguigu.pojo.TicketSync;

public class SellTicketDemo {
    public static void main(String[] args){
        TicketSync ticket = new TicketSync();

        new Thread(new Runnable() {
            @Override
            public void run() {
                while(ticket.determine()){
                    ticket.sale();
                }
            }
        },"A").start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                while(ticket.determine()){
                    ticket.sale();
                }
            }
        },"B").start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                while(ticket.determine()){
                    ticket.sale();
                }
            }
        },"C").start();
    }
}
